]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
screenshot: Check for NULL window in screenshot_window()
authorFlorian Müllner <fmuellner@gnome.org>
Sun, 19 May 2013 10:26:49 +0000 (12:26 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Sun, 19 May 2013 13:32:06 +0000 (15:32 +0200)
screenshot_window() currently assumes a focus window, which will
result in a crash if that's not the case.

https://bugzilla.gnome.org/show_bug.cgi?id=700625

src/shell-screenshot.c

index c354612c5493c0d0124ca00f3f58462528e6c6e9..4eca28983b74c9b5eb0087c1681440c15304540e 100644 (file)
@@ -492,6 +492,17 @@ shell_screenshot_screenshot_window (ShellScreenshot *screenshot,
   screenshot_data->filename = g_strdup (filename);
   screenshot_data->callback = callback;
 
+  if (!window)
+    {
+      screenshot_data->filename_used = g_strdup ("");
+      result = g_simple_async_result_new (NULL, on_screenshot_written, (gpointer)screenshot_data, shell_screenshot_screenshot_window);
+      g_simple_async_result_set_op_res_gboolean (result, FALSE);
+      g_simple_async_result_complete (result);
+      g_object_unref (result);
+
+      return;
+    }
+
   window_actor = CLUTTER_ACTOR (meta_window_get_compositor_private (window));
   clutter_actor_get_position (window_actor, &actor_x, &actor_y);